using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using SiteECSWeb;
using System.ComponentModel;
using System.Web.Caching;


/// <summary>
/// Summary description for CacheStatic
/// </summary>

    [System.ComponentModel.DataObject]
    public class CacheStatic
    {

        private static EcsSiteDS.EcsOfficDataTable AllOffices = null ;
        private static EcsSiteDS.ProductCategoryDataTable AllProdCateg = null;
        private static EcsSiteDS.EmbassyDataTable AllEmbassy = null;

        public static void LoadStaticCache()
        {
            EcsOfficeBLL OfficesBLL = new EcsOfficeBLL() ;
            HttpContext.Current.Application["key"] =  OfficesBLL.GetAllEcsOffice();


            ProductCategoryBLL ProdCategoryBLL = new ProductCategoryBLL();
            HttpContext.Current.Application["key"] = ProdCategoryBLL.GetALlProductCatgoryData();

            //EmbassyBLL EmbassyBLL = new EmbassyBLL();
            //HttpContext.Current.Application["key"] = EmbassyBLL.GetAllEmbassyData();

             

        }
        #region cachinEcsOffices
        [DataObjectMethodAttribute(DataObjectMethodType.Select, true)]
        public static EcsSiteDS.EcsOfficDataTable GetAllOffices()
        {
            return HttpContext.Current.Application["key"] as EcsSiteDS.EcsOfficDataTable;
        }
        #endregion
        

        #region caching ProductsCategory
        [DataObjectMethodAttribute(DataObjectMethodType.Select, true)]
        public static EcsSiteDS.ProductCategoryDataTable GetAllProdCategory()
        {
            return HttpContext.Current.Application["key"] as EcsSiteDS.ProductCategoryDataTable;
        }
            #endregion

        #region caching All Embassy
        [DataObjectMethodAttribute(DataObjectMethodType.Select, true)]
        public static EcsSiteDS.EmbassyDataTable GetAllEmbassy()
        {
            return HttpContext.Current.Application["key"] as EcsSiteDS.EmbassyDataTable;
        }
        #endregion


        //public static DataTable TendersGets()
        //{
        //    if (HttpRuntime.Cache["TendersGets"] != null)
        //    {
        //        return (DataTable)HttpRuntime.Cache["TendersGets"];
        //    }
        //    else
        //    {
        //        string themeDirPath =
        //            HttpContext.Current.Server.MapPath("~/App_Themes");
        //        string[] themes = Directory.GetDirectories(themeDirPath);
        //        for (int i = 0; i <= themes.Length - 1; i++)
        //        {
        //            themes[i] = Path.GetFileName(themes[i]);
        //        }
        //        CacheDependency cachedep = new CacheDependency(themeDirPath);
        //        HttpRuntime.Cache.Insert("Sitethemes", themes, cachedep);
        //        return themes;
        //    }
        //}
    }

    
      
